import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
 state: {
        forcedLogin: false,//是否需要强制登录
        hasLogin: false,
        userName: "",
        userId:'',
        authtoken:'',
        pointId:'',
    },
    mutations: {
        logins(state, user) {
            state.userName = user.username || '';
            state.hasLogin = true;
            state.userId = user.id || '';
            state.authtoken = user.authtoken || '';
            state.pointId = user.pointId || '';
			},
        logout(state) {
           state.userName = "";
           state.hasLogin = false;
           state.userId = '';
           state.authtoken = '';
           state.pointId = '';
		  },
		UserInfo(state,a){
			state.token = a
		}
    }
})

export default store
